/**
 * @description 批量压缩图片
 * @params { Array } img
 * @params { Number } level
 * */

function compressImage({ imgs = [], level = 4 }) {
  if (imgs.length === 0) {
    return;
  }
  if (![1, 2, 3, 4].includes(level)) {
    return;
  }
  my.compressImage({
    apFilePaths: imgs,
    compressLevel: level,
    success(res) {
      console.log('compressImage 调用成功', res);
    },
    fail(err) {
      console.log('compressImage 调用失败', err);
    },
    success(res) {
      console.log('compressImage 调用完成', res);
    },
  });
}

export default compressImage;
